# -*- coding:utf-8 -*-

import os


def main():
    filepath = os.path.join(r'D:\Program Files (x86)\sscom',
                            '0FDC.DAT')
    f = open(filepath, 'rb')
    content = f.read()
    f.close()
    start = 0xA907 - 0x9000
    print(f'0x{start+0x9000:04X}')
    length = 0x10
    end = start
    while content[end]:
        end += 1
    print('字符串长度：', end-start)
    try:
        print(content[start:end].decode('GBK'))
    except Exception as e:
        print(e)
    print(','.join(['0x{:02X}'.format(content[start+i]) for i in range(length)]))
    print(','.join(['0x{:04X}'.format((content[start+i+1]<<8)+content[start+i]) for i in range(0, length, 2)]))
    print(','.join(['0x{:08X}'.format((content[start+i+3]<<24)+(content[start+i+2]<<16)+(content[start+i+2]<<8)+content[start+i]) for i in range(0, length, 4)]))


if __name__ == '__main__':
    main()